home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / t2win-32 / _dib-bmp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-08-24  |  9.1 KB  |  261 lines

  1. VERSION 4.00
  2. Begin VB.Form frmDIBBitmap 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "DIB & Bitmap"
  5.    ClientHeight    =   5685
  6.    ClientLeft      =   1725
  7.    ClientTop       =   1785
  8.    ClientWidth     =   7485
  9.    Height          =   6090
  10.    Left            =   1665
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   5685
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   1440
  17.    Width           =   7605
  18.    Begin VB.CommandButton Command1 
  19.       Caption         =   "Load"
  20.       Height          =   375
  21.       Left            =   6750
  22.       TabIndex        =   8
  23.       Top             =   2610
  24.       Visible         =   0   'False
  25.       Width           =   645
  26.    End
  27.    Begin VB.PictureBox Picture1 
  28.       AutoRedraw      =   -1  'True
  29.       Height          =   2985
  30.       Left            =   90
  31.       ScaleHeight     =   2925
  32.       ScaleWidth      =   7245
  33.       TabIndex        =   7
  34.       Top             =   2610
  35.       Width           =   7305
  36.    End
  37.    Begin VB.TextBox txt_Result 
  38.       BackColor       =   &H00C0C0C0&
  39.       BorderStyle     =   0  'None
  40.       Height          =   1845
  41.       Left            =   105
  42.       Locked          =   -1  'True
  43.       MultiLine       =   -1  'True
  44.       ScrollBars      =   2  'Vertical
  45.       TabIndex        =   0
  46.       Top             =   630
  47.       Width           =   7260
  48.    End
  49.    Begin Threed.SSPanel SSPanel1 
  50.       Align           =   1  'Align Top
  51.       Height          =   480
  52.       Left            =   0
  53.       TabIndex        =   1
  54.       Top             =   0
  55.       Width           =   7485
  56.       _Version        =   65536
  57.       _ExtentX        =   13203
  58.       _ExtentY        =   847
  59.       _StockProps     =   15
  60.       ForeColor       =   -2147483640
  61.       BackColor       =   12632256
  62.       Begin VB.ComboBox cmb_Function 
  63.          Height          =   315
  64.          Left            =   1365
  65.          TabIndex        =   2
  66.          Top             =   90
  67.          Width           =   4785
  68.       End
  69.       Begin Threed.SSCommand SSCommand1 
  70.          Default         =   -1  'True
  71.          Height          =   300
  72.          Left            =   6615
  73.          TabIndex        =   6
  74.          Top             =   90
  75.          Width           =   465
  76.          _Version        =   65536
  77.          _ExtentX        =   820
  78.          _ExtentY        =   529
  79.          _StockProps     =   78
  80.          Caption         =   "&Go"
  81.          BevelWidth      =   1
  82.          RoundedCorners  =   0   'False
  83.          Outline         =   0   'False
  84.       End
  85.       Begin VB.Label Label2 
  86.          Caption         =   "&Select a function"
  87.          Height          =   255
  88.          Left            =   90
  89.          TabIndex        =   5
  90.          Top             =   120
  91.          Width           =   1275
  92.       End
  93.       Begin Threed.SSCommand cmdNP 
  94.          Height          =   300
  95.          Index           =   0
  96.          Left            =   6300
  97.          TabIndex        =   4
  98.          Top             =   90
  99.          Width           =   255
  100.          _Version        =   65536
  101.          _ExtentX        =   450
  102.          _ExtentY        =   529
  103.          _StockProps     =   78
  104.          Caption         =   "<"
  105.          BevelWidth      =   1
  106.          Font3D          =   3
  107.          RoundedCorners  =   0   'False
  108.          Outline         =   0   'False
  109.       End
  110.       Begin Threed.SSCommand cmdNP 
  111.          Height          =   300
  112.          Index           =   1
  113.          Left            =   7140
  114.          TabIndex        =   3
  115.          Top             =   90
  116.          Width           =   255
  117.          _Version        =   65536
  118.          _ExtentX        =   450
  119.          _ExtentY        =   529
  120.          _StockProps     =   78
  121.          Caption         =   ">"
  122.          BevelWidth      =   1
  123.          Font3D          =   3
  124.          RoundedCorners  =   0   'False
  125.          Outline         =   0   'False
  126.       End
  127.    End
  128. Attribute VB_Name = "frmDIBBitmap"
  129. Attribute VB_Creatable = False
  130. Attribute VB_Exposed = False
  131. Option Explicit
  132. Option Base 1
  133. Private Const Iteration = 3
  134. Dim IsLoaded         As Integer
  135. Dim TimerStartOk     As Integer
  136. Dim TimerCloseOk     As Integer
  137. Dim TimerHandle      As Integer
  138. Dim TimerValue       As Long
  139. Private Sub cmdNP_Click(Index As Integer)
  140.    Call sub_NextPrev(cmb_Function, Index)
  141. End Sub
  142. Private Sub cmb_Function_Click()
  143.    If (IsLoaded = False) Then Exit Sub
  144.    Call cDisableFI(mdiT2W.Picture1)
  145.    txt_Result = ""
  146.    DoEvents
  147.    Command1.Visible = False
  148.    Picture1.Width = 7305
  149.    Select Case cmb_Function.ListIndex
  150.       Case 0
  151.          Call TestDIBSaveScreen
  152.       Case 1
  153.          Call TestDIBSaveWindow
  154.       Case 2
  155.          Picture1.Width = 6585
  156.          Command1.Visible = True
  157.          Call TestInstallHookKeyboard
  158.    End Select
  159.    DoEvents
  160.    Call cEnableFI(mdiT2W.Picture1)
  161. End Sub
  162. Private Sub Command1_Click()
  163.    If (cFilePathExists(T2WDirTest + "\TESTDIB.BMP") = True) Then
  164.       Picture1.Picture = LoadPicture(T2WDirTest + "\TESTDIB.BMP")
  165.    Else
  166.       MsgBox "File '" & T2WDirTest + "\TESTDIB.BMP" & "' not found"
  167.    End If
  168. End Sub
  169. Private Sub Form_Activate()
  170.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  171. End Sub
  172. Private Sub Form_Load()
  173.    IsLoaded = False
  174.    Show
  175.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_dib-bmp.t2w")
  176.    IsLoaded = True
  177. End Sub
  178. Private Sub SSCommand1_Click()
  179.    Call cmb_Function_Click
  180. End Sub
  181. Private Sub TestDIBSaveWindow()
  182.    Dim intResult        As Integer
  183.    Dim strResult        As String
  184.    Dim strDisplay       As String
  185.    Dim strFile          As String
  186.    Dim i                As Integer
  187.    strFile = T2WDirTest + "\snap_win.bmp"
  188.    intResult = cDIBSaveWindow(Me.hWnd, DIB_SAVE_WINDOW, strFile)
  189.    If (intResult = True) Then
  190.       strDisplay = strDisplay & "Active window has been saved" & vbCrLf & "in the file '" & strFile & "'" & vbCrLf & vbCrLf
  191.    Else
  192.       strDisplay = strDisplay & "Active window can't be saved" & vbCrLf & "in the file '" & strFile & "'" & vbCrLf & vbCrLf
  193.    End If
  194.    txt_Result = strDisplay
  195.    Picture1.Picture = LoadPicture(strFile)
  196.    'time the function
  197.    TimerHandle = cTimerOpen()
  198.    TimerStartOk = cTimerStart(TimerHandle)
  199.    For i = 1 To Iteration
  200.       intResult = cDIBSaveWindow(Me.hWnd, DIB_SAVE_WINDOW, strFile)
  201.    Next i
  202.    intResult = cKillFile(strFile)
  203.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  204.    TimerCloseOk = cTimerClose(TimerHandle)
  205. End Sub
  206. Private Sub TestDIBSaveScreen()
  207.    Dim intResult        As Integer
  208.    Dim strResult        As String
  209.    Dim strDisplay       As String
  210.    Dim strFile          As String
  211.    Dim i                As Integer
  212.    strFile = T2WDirTest + "\snap_scr.bmp"
  213.    intResult = cDIBSaveScreen(strFile)
  214.    If (intResult = True) Then
  215.       strDisplay = strDisplay & "Screen has been saved" & vbCrLf & "in the file '" & strFile & "'" & vbCrLf & vbCrLf
  216.    Else
  217.       strDisplay = strDisplay & "Screen can't be saved" & vbCrLf & "in the file '" & strFile & "'" & vbCrLf & vbCrLf
  218.    End If
  219.    txt_Result = strDisplay
  220.    Picture1.Picture = LoadPicture(strFile)
  221.    'time the function
  222.    TimerHandle = cTimerOpen()
  223.    TimerStartOk = cTimerStart(TimerHandle)
  224.    For i = 1 To Iteration
  225.       intResult = cDIBSaveScreen(strFile)
  226.    Next i
  227.    intResult = cKillFile(strFile)
  228.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  229.    TimerCloseOk = cTimerClose(TimerHandle)
  230. End Sub
  231. Private Sub TestInstallHookKeyboard()
  232.    Dim intResult        As Integer
  233.    Dim strResult        As String
  234.    Dim strDisplay       As String
  235.    Dim strFile          As String
  236.    Dim i                As Integer
  237.    intResult = cInstallHookKeyboard(True)
  238.    If (intResult = True) Then
  239.       strDisplay = strDisplay & "InstallHookKeyboard has been successfully installed" & vbCrLf & vbCrLf
  240.    Else
  241.       strDisplay = strDisplay & "InstallHookKeyboard has been already installed" & vbCrLf & vbCrLf
  242.    End If
  243.    strDisplay = strDisplay & "Press ALT+CTRL+SHIFT+F11 to save the screen" & vbCrLf
  244.    strDisplay = strDisplay & "Press ALT+CTRL+SHIFT+F12 to save the active window" & vbCrLf & vbCrLf
  245.    strDisplay = strDisplay & "For the test" & vbCrLf
  246.    strDisplay = strDisplay & "   don't change the directory" & vbCrLf
  247.    strDisplay = strDisplay & "   enter the name of the file TESTDIB" & vbCrLf
  248.    strDisplay = strDisplay & "   select a file type" & vbCrLf
  249.    strDisplay = strDisplay & "   push the OK button" & vbCrLf
  250.    strDisplay = strDisplay & "   push the LOAD command button" & vbCrLf
  251.    txt_Result = strDisplay
  252.    'time the function
  253.    TimerHandle = cTimerOpen()
  254.    TimerStartOk = cTimerStart(TimerHandle)
  255.    For i = 1 To Iteration
  256.       intResult = cInstallHookKeyboard(True)
  257.    Next i
  258.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  259.    TimerCloseOk = cTimerClose(TimerHandle)
  260. End Sub
  261.